package com.njust.controller;

import com.njust.form.CaliForm;
import com.njust.form.ParamForm;
import com.njust.service.SysParamService;
import com.njust.vo.ParamVO;
import com.njust.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 系统参数 （阈值的设定、系统标定值）
 * @author zjwpro@foxmail.com
 * @date 2018/1/10 下午4:40
 */
@RestController
@RequestMapping("/settings")
@Api("参数设置")
public class SystemParamController {

    @Autowired
    private SysParamService sysParamService;

    /**
     * 保存阈值
     * @param paramFormList
     * @return
     */
    @PostMapping("/trainparam/save")
    @ApiOperation(value="阈值设置")
    public ResultVO paramSave(@RequestBody List<ParamForm> paramFormList){
        ResultVO resultVO = sysParamService.paramSave(paramFormList);
        return resultVO;
    }

    /**
     * 查询阈值状态
     * @return
     */
    @GetMapping("/trainparam")
    @ApiOperation(value="阈值查看",notes = "回显")
    public ResultVO<List<ParamVO>> selectLastId(){
        ResultVO<List<ParamVO>> listResultVO = sysParamService.showParam();
        return listResultVO;
    }

    /**
     * 保存标定值
     * @param caliFormList
     * @return
     */
    @PostMapping("/traincali/save")
    @ApiOperation(value="标定设置")
    public ResultVO caliSave(@RequestBody List<CaliForm> caliFormList){
        ResultVO resultVO = sysParamService.caliSave(caliFormList);
        return resultVO;
    }

    @GetMapping("/traincali")
    @ApiOperation(value="标定查看",notes= "回显")
    public ResultVO showCail(){
        ResultVO resultVO = sysParamService.showCail();
        return resultVO;
    }


}
